package com.garbage.controller;

import com.alibaba.fastjson.JSON;
import com.garbage.pojo.User;
import com.garbage.service.UserService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Author: abin
 * Date: 2021-04-23
 * Description:
 */

@Controller
public class UserController {

    @Autowired
    private UserService userService;

    @ResponseBody
    @RequestMapping("/findUser")
//    测试 url  http://localhost:8080/findUser?username=123456&password=123456
    public String findUser(String username,String password){
        User user = userService.findUser(username, password);
        String result = JSON.toJSONString(user);
        return result;
    }
}
